import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImportPlugin from 'unplugin-auto-import/vite';
import { resolve } from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(), 
    AutoImportPlugin({
    // 自动导入vue、vue-router相关的api
      imports: ["vue", "vue-router", "pinia"],
      eslintrc: {
        enabled: true
      }
    })
],
  resolve: {
    alias: {
      '@': resolve(__dirname, 'src'),
      '*': resolve(''),
    }
  },
  css: {
    preprocessorOptions: {
      less: {
        charset: false
      }
    }
  },
  // 服务
  server: {
    open: true,
    // 代理
    proxy: {
      '/api': {
        target: 'http://127.0.0.1:3000'
      } 
    }
  }
})
